<template>
  <div class="receiveContent">
    <div class="receiveTitle">
      <div class="customerTitle">海川医药收货组{{ systemTime }}日报</div>
      <el-button type="success" @click="saveReceivedaily">保存</el-button>
    </div>
    <div class="customtr1">
      <div class="customText">客户/类别</div>
      <div class="delivery">
        <div class="deliveryTop">完成</div>
        <div class="deliveryBottom">
          <span>入库件数</span>
          <span>入库条目</span>
          <span>破损率</span>
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">未完成</div>
        <div class="deliveryBottom">
          <span>入库件数</span>
          <span>入库条目</span>
          <span>破损率</span>
        </div>
      </div>
      <div class="customText">备注(当日异常)</div>
      <div class="completeText">完成时间点</div>
    </div>
    <div class="customtr2">
      <div class="customText wyLayout">陕西海通</div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input
            @input="calculatewcrkjsTotal"
            v-model="reform.htWcRkjs"
            size="medium"
          />
        </div>
      </div>
      <div class="customText">
        <el-input
          @input="calculatewcrktmTotal"
          v-model="reform.htWcRktms"
          size="medium"
        />
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <div class="beakageRate">
            <el-input v-model="reform.htWcPsl" size="medium" />
            <span>%</span>
          </div>
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input
            @input="calculatewwcrkjsTotal"
            v-model="reform.htWwcRkjs"
            size="medium"
          />
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input
            @input="calculatewwcrktmTotal"
            v-model="reform.htWwcRktms"
            size="medium"
          />
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <div class="beakageRate">
            <el-input v-model="reform.htWwcPsl" size="medium" />
            <span>%</span>
          </div>
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input v-model="reform.htBz" size="medium" />
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop noborder">
          <el-time-picker
            v-model="reform.htWcsjd"
            placeholder=""
            value-format="HH:mm"
            format="HH:mm"
          >
          </el-time-picker>
        </div>
      </div>
    </div>
    <div class="customtr2">
      <div class="customText wyLayout">陕西伟业</div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input
            @input="calculatewcrkjsTotal"
            v-model="reform.wyWcRkjs"
            size="medium"
          />
        </div>
      </div>
      <div class="customText">
        <el-input
          @input="calculatewcrktmTotal"
          v-model="reform.wyWcRktms"
          size="medium"
        />
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <div class="beakageRate">
            <el-input v-model="reform.wyWcPsl" size="medium" />
            <span>%</span>
          </div>
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input
            @input="calculatewwcrkjsTotal"
            v-model="reform.wyWwcRkjs"
            size="medium"
          />
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input
            @input="calculatewwcrktmTotal"
            v-model="reform.wyWwcRktms"
            size="medium"
          />
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <div class="beakageRate">
            <el-input v-model="reform.wyWwcPsl" size="medium" />
            <span>%</span>
          </div>
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop">
          <el-input v-model="reform.wyBz" size="medium" />
        </div>
      </div>
      <div class="delivery">
        <div class="deliveryTop noborder">
          <el-time-picker
            v-model="reform.wyWcsjd"
            placeholder=""
            value-format="HH:mm"
            format="HH:mm"
          >
          </el-time-picker>
        </div>
        <!-- <div class="deliveryBottom noborder">
          <el-time-picker
            v-model="form.wyTimeCWcsj"
            placeholder=""
            value-format="HH:mm"
            format="HH:mm"
          >
          </el-time-picker>
        </div> -->
      </div>
    </div>
    <div class="customtr3">
      <div class="customText wyLayout">其他货主</div>
      <div class="customText">
        <el-input
          @input="calculatewcrkjsTotal"
          v-model="reform.qtWcRkjs"
          size="medium"
        />
      </div>
      <div class="customText">
        <el-input
          @input="calculatewcrktmTotal"
          v-model="reform.qtWcRktms"
          size="medium"
        />
      </div>
      <div class="customText">
        <div class="beakageRate">
          <el-input v-model="reform.qtWcPsl" size="medium" />
          <span>%</span>
        </div>
      </div>
      <div class="customText">
        <el-input
          @input="calculatewwcrkjsTotal"
          v-model="reform.qtWwcRkjs"
          size="medium"
        />
      </div>
      <div class="customText">
        <el-input
          @input="calculatewwcrktmTotal"
          v-model="reform.qtWwcRktms"
          size="medium"
        />
      </div>
      <div class="customText">
        <div class="beakageRate">
          <el-input v-model="reform.qtWwcPsl" size="medium" />
          <span>%</span>
        </div>
      </div>
      <div class="customText">
        <el-input v-model="reform.qtBz" size="medium" />
      </div>
      <div class="completeText">
        <el-time-picker
          v-model="reform.qtWcsjd"
          placeholder=""
          value-format="HH:mm"
          format="HH:mm"
        >
        </el-time-picker>
      </div>
    </div>
    <div class="customtr4">
      <div class="customText wyLayout">合计</div>
      <!-- <div class="customText"></div> -->
      <div class="customText">
        <el-input disabled v-model="wcrkjsTotal" size="medium" />
      </div>
      <div class="customText">
        <el-input disabled v-model="wcrktmTotal" size="medium" />
      </div>
      <div class="customText">
        <el-input disabled size="medium" />
      </div>
      <div class="customText">
        <el-input disabled v-model="wwcrkjsTotal" size="medium" />
      </div>
      <div class="customText">
        <el-input disabled v-model="wwcrktmTotal" size="medium" />
      </div>
      <div class="customText">
        <el-input disabled size="medium" />
      </div>
      <div class="customText">
        <el-input disabled size="medium" />
      </div>
      <div class="completeText"></div>
    </div>
  </div>
</template>

<script>
import { dailyaddreceive, dailylistreceive } from "@/api/system/daily";
export default {
  data() {
    return {
      // 陕西海通零货条目数
      ids: null,
      systemTime: "",
      wcrkjsTotal: undefined,
      wcrktmTotal: undefined,
      wwcrkjsTotal: undefined,
      wwcrktmTotal: undefined,
      // 伟业
      reform: {
        rbSj: new Date().toISOString().split("T")[0],
        // 海通
        htWcRkjs: null,
        htWcRktms: null,
        htWcPsl: null,
        htWwcRkjs: null,
        htWwcRktms: null,
        htWwcPsl: null,
        htBz: null,
        htWcsjd: null,
        // 伟业
        wyWcRkjs: null,
        wyWcRktms: null,
        wyWcPsl: null,
        wyWwcRkjs: null,
        wyWwcRktms: null,
        wyWwcPsl: null,
        wyBz: null,
        wyWcsjd: null,
        // 其他
        qtWcRkjs: null,
        qtWcRktms: null,
        qtWcPsl: null,
        qtWwcRkjs: null,
        qtWwcRktms: null,
        qtWwcPsl: null,
        qtWcsjd: null,
      },
    };
  },
  mounted() {
    // 创建一个 Date 对象
    const currentDate = new Date();
    // 获取当前年份
    const year = currentDate.getFullYear();
    // 获取当前月份（注意：月份是从 0 开始计数的，所以需要加 1）
    const month = currentDate.getMonth() + 1;
    // 获取当前日期
    const day = currentDate.getDate();
    // 打印年月日
    this.systemTime = `${year}年${month}月${day}日`;
    this.getreTodayList();
  },
  beforeDestroy() {},
  methods: {
    calculatewcrkjsTotal() {
      this.wcrkjsTotal =
        Number(this.reform.htWcRkjs) +
        Number(this.reform.wyWcRkjs) +
        Number(this.reform.qtWcRkjs);
    },
    calculatewcrktmTotal() {
      this.wcrktmTotal =
        Number(this.reform.htWcRktms) +
        Number(this.reform.wyWcRktms) +
        Number(this.reform.qtWcRktms);
    },
    calculatewwcrkjsTotal() {
      this.wwcrkjsTotal =
        Number(this.reform.htWwcRkjs) +
        Number(this.reform.wyWwcRkjs) +
        Number(this.reform.qtWwcRkjs);
    },
    calculatewwcrktmTotal() {
      this.wwcrktmTotal =
        Number(this.reform.htWwcRktms) +
        Number(this.reform.wyWwcRktms) +
        Number(this.reform.qtWwcRktms);
    },
    // 获取收货列表
    getreTodayList() {
      dailylistreceive().then((res) => {
        if (res.data) {
          this.reform = res.data;
          this.wcrkjsTotal =
            Number(this.reform.htWcRkjs) +
            Number(this.reform.wyWcRkjs) +
            Number(this.reform.qtWcRkjs);
          this.wcrktmTotal =
            Number(this.reform.htWcRktms) +
            Number(this.reform.wyWcRktms) +
            Number(this.reform.qtWcRktms);
          this.wwcrkjsTotal =
            Number(this.reform.htWwcRkjs) +
            Number(this.reform.wyWwcRkjs) +
            Number(this.reform.qtWwcRkjs);
          this.wwcrktmTotal =
            Number(this.reform.htWwcRktms) +
            Number(this.reform.wyWwcRktms) +
            Number(this.reform.qtWwcRktms);
        }
      });
    },
    saveReceivedaily() {
      console.log(this.form);
      dailyaddreceive(this.reform).then((res) => {
        console.log(res);
        this.$modal.msgSuccess("新增成功");
        this.getreTodayList();
      });
    },
    // 设置表格边框颜色
    tableCellStyle() {
      return "border-color: #181616";
    },
  },
};
</script>

<style lang="scss" scoped>
.receiveContent {
  width: 100%;
  height: 100%;
  ::v-deep .el-table__body-wrapper {
    border: 1px solid #181616;
  }
  .el-table--group::after,
  .el-table--border::after {
    background-color: #181616;
  }
  ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
    background-color: transparent;
  }
  ::v-deep .el-input__inner {
    height: 65px;
    line-height: 65px;
    border: none;
    text-align: center;
    color: #000000;
    width: 100%;
  }
  ::v-deep .el-date-editor.el-input,
  .el-date-editor.el-input__inner {
    width: 100%;
  }
  ::v-deep .el-input--prefix .el-input__inner {
    border: none;
  }
  ::v-deep .el-table tr {
    height: 70px;
  }

  .receiveTitle {
    display: flex;
    align-items: center;
    .customerTitle {
      width: 100%;
      font-size: 24px;
      font-weight: 700;
      margin: 30px 0 40px 0;
    }
    ::v-deep .el-button--success {
      height: 36px;
    }
  }
  .customtr1 {
    width: 100%;
    height: 140px;
    border: 1px solid #e7dfdf;
    background: #05a5ff;
    display: flex;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    justify-content: space-around;
    .customText {
      width: 11.1%;
      height: 140px;
      line-height: 140px;
      text-align: center;
      border-right: 1px solid #e7dfdf;
    }
    .completeText {
      width: 11.1%;
      height: 140px;
      line-height: 140px;
      text-align: center;
    }
    .delivery {
      width: 33.35%;
      display: flex;
      flex-direction: column;
      .deliveryTop {
        height: 50%;
        line-height: 70px;
        border-right: 1px solid #e7dfdf;
      }
      .deliveryBottom {
        height: 50%;
        display: flex;
        justify-content: space-around;
        border-top: 1px solid #e7dfdf;
        span {
          width: 34%;
          height: 100%;
          line-height: 70px;
          text-align: center;
          border-right: 1px solid #e7dfdf;
        }
      }
    }
    .ReceiveNoSent {
      width: 20%;
      .deliveryTop {
        height: 50%;
        line-height: 70px;
        border-right: 1px solid #e7dfdf;
      }
      .deliveryBottom {
        height: 50%;
        display: flex;
        justify-content: space-around;
        border-top: 1px solid #e7dfdf;
        span {
          width: 50%;
          height: 100%;
          line-height: 70px;
          text-align: center;
          border-right: 1px solid #e7dfdf;
        }
      }
    }
  }
  .customtr2 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    // background: #00d9ff;
    display: flex;
    justify-content: space-around;
    .customText {
      width: 11.1%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    .wyLayout {
      font-weight: 700;
    }
    .delivery {
      width: 11.1%;
      display: flex;
      flex-direction: column;
      //   border-right: 1px solid #181616;
      .deliveryTop {
        height: 100%;
        line-height: 70px;
        border-right: 1px solid #181616;
        .beakageRate {
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
      }
      .noborder {
        border-right: none !important;
      }
      // .deliveryBottom {
      //   height: 50%;
      //   display: flex;
      //   line-height: 70px;
      //   justify-content: space-around;
      //   border-top: 1px solid #181616;
      //   border-right: 1px solid #181616;
      // }
    }
  }
  .customtr3 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    // background: #00d9ff;
    display: flex;
    justify-content: space-around;
    .customText {
      width: 11.1%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
      .beakageRate {
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
    }
    .totalText {
      width: 20%;
    }
    .wyLayout {
      font-weight: 700;
    }
    .completeText {
      width: 11.1%;
      height: 70px;
      line-height: 70px;
      text-align: center;
    }
  }
  .customtr4 {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #181616;
    border-left: 1px solid #181616;
    border-right: 1px solid #181616;
    background: #75d561;
    display: flex;
    justify-content: space-around;
    ::v-deep .el-input.is-disabled .el-input__inner {
      background: #75d561;
      font-weight: 700;
      color: #ff4800;
      font-size: 18px;
    }
    .customText {
      width: 11.1%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-right: 1px solid #181616;
    }
    // .totalText {
    //   width: 11.1%;
    // }
    .bhxsbg {
      background: #f5f7fa;
      border-bottom: 1px solid #181616;
    }
    .wyLayout {
      font-weight: 700;
    }
    .completeText {
      background: #75d561;
      width: 11.1%;
      height: 70px;
      line-height: 70px;
      text-align: center;
      border-bottom: 1px solid #181616;
    }
  }
}
</style>